using System.Runtime.Serialization;

namespace MiniStock.Entities.Stock.Events.Customer
{
    [DataContract]
    public class ChangeContactPersonEvent : CustomerEventBase
    {
        [DataMember]
        public string FirstName { get; set; }
        [DataMember]
        public string LastName { get; set; }
        [DataMember]
        public string Email { get; set; }
        [DataMember]
        public string Phone { get; set; }

        public override void ApplyTo(Common.EntityBase entity)
        {
            base.ApplyTo(entity);
            ((Stock.Customer) entity).ContactPerson = new ContactPerson()
                                                          {
                                                              Email = this.Email,
                                                              FirstName = this.FirstName,
                                                              LastName = this.LastName,
                                                              Phone = this.Phone,
                                                          };
        }
    }
}